package com.acegear.horizon.domain.models.jpa;

import com.acegear.horizon.domain.models.constraint.FeedType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * Created by wuwf on 17/4/13.
 * 俱乐部里的feed流，帖子或者活动
 */
@Entity
@EntityListeners(AuditingEntityListener.class)
public class ClubFeed {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @JsonIgnore
    private Long id;
    /**
     * 俱乐部ID
     */
    private Long clubId;
    /**
     * 关联的ID（帖子ID，活动ID等）
     */
    private Long relateId;
    /**
     * 位置，给客户端展示从大到小，越新的越大，10-9-8顺序展示。
     */
    private Integer position;
    /**
     * 创建时的位置，恢复原位置
     */
    private Integer oldPositon;
    /**
     * 类型（帖子、活动）
     */
    private FeedType feedType;
    /**
     * 是否被置顶（true为置顶），用于方便客户端展示
     */
    private boolean top;

    @CreatedDate
    private Long createAt;

    @LastModifiedDate
    private Long updateAt;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public boolean isTop() {
        return top;
    }

    public void setTop(boolean top) {
        this.top = top;
    }

    public Long getClubId() {
        return clubId;
    }

    public void setClubId(Long clubId) {
        this.clubId = clubId;
    }

    public Integer getOldPositon() {
        return oldPositon;
    }

    public void setOldPositon(Integer oldPositon) {
        this.oldPositon = oldPositon;
    }

    public Long getRelateId() {
        return relateId;
    }

    public void setRelateId(Long relateId) {
        this.relateId = relateId;
    }

    public Integer getPosition() {
        return position;
    }

    public void setPosition(Integer position) {
        this.position = position;
    }

    public FeedType getFeedType() {
        return feedType;
    }

    public void setFeedType(FeedType feedType) {
        this.feedType = feedType;
    }

    public Long getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Long createAt) {
        this.createAt = createAt;
    }

    public Long getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Long updateAt) {
        this.updateAt = updateAt;
    }
}
